﻿using System.Collections.Generic;
using BSDS.Commands.Commands.Implementation.Jobs;
using BSDS.Core.Model.Services;
using BSDS.Core.Model.Services.Geocoding;
using BSDS.Core.Model.Services.Jobs;
using BSDS.Core.Model.Services.Uploading;

namespace BSDS.Commands.Commands.Creation.Implementation.Jobs
{
    public class CleanJobsCommandCreator : CommandCreatorBase
    {
        private readonly JobRepository repository;
        private readonly GeocodingService geocodingService;
        private readonly UploadService uploadService;
        private readonly DownloadService downloadService;

        public CleanJobsCommandCreator(JobRepository repository, GeocodingService geocodingService, 
            UploadService uploadService, DownloadService downloadService)
        {
            this.repository = repository;
            this.geocodingService = geocodingService;
            this.uploadService = uploadService;
            this.downloadService = downloadService;
        }

        protected override bool Supports(Dictionary<string, string> parameters)
        {
            return parameters.Keys.Count == 1 && parameters.ContainsKey("cleanjobs");
        }

        protected override ICommand Create(Dictionary<string, string> parameters)
        {
            return new CleanJobsCommand(repository, geocodingService, uploadService, downloadService);
        }
    }
}